<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../../common.jsp"%>
<!doctype html>
<html>
<head>
<title>订单详情</title>
</head>
<body ontouchstart>

	<header class="contHeader">
		<div class="contOHeader" style="z-index:1000;">
			<h1>订单详情</h1>
			<div class="contOHeadBack">
				<a href="javascript:gotoHtml('/buyer/buyer.html');"><img
					src="${staticPath}/images/back2.png"></a>
			</div>

		</div>
	</header>
	<div class="weui_cells weui_cells_access">
		<a class="weui_cell" href="javascript:;">
			<div class="weui_cell_bd weui_cell_primary">
				<img src="${staticPath}/images/dz.png" class="float dz">
				<h5>收件人：${order.name }${order.telephone}</h5>
				<p class="font12">送货地址：${order.address}</p>
			</div>
		</a>
	</div>
	<div class="weui_cells_title"
		style="background: #efefef; color: #000; font-size: 16px; margin-top: 5px;">
		<input type="checkbox" value="${order.id}" parent="" level="1" style="margin-right: 10px;" onclick="changeSelect(this,1)"/>
		<fmt:formatDate value="${ order.createdAt }" type="both" />
	</div>
	<c:set var="sum" value="0"></c:set>
	<c:forEach items="${order.storageOrder}" var="storageOrder">
		<div class="weui_cells_title" >
			<input type="checkbox" value="${storageOrder.id}" parent="${order.id}" level="2" style="margin-right: 10px;" onclick="changeSelect(this,2)"/><span>${storageOrder.storage.name}</span>
			<p style="float:right;color:#568aed;">状态：${orderState[storageOrder.state]}</p>
		</div>
		<div class="weui_cells_title" style="border-top: #ddd 1px solid;padding-top:5px;">
			<span>订单号：${storageOrder.code}</span>
		</div>
		<c:if test="${storageOrder.expressCode!=null&&storageOrder.expressCode!=''}">
		<div class="weui_cells_title" style="border-top: #ddd 1px solid;padding-top:5px;">
			<span>物流号：${storageOrder.expressCode}
			</span>
			<p style="float:right;color:#568aed;" onclick="gotoHtml('/order/express.html?storageOrderId=${storageOrder.id}');">查看物流</p>
		</div>
		</c:if>
		<c:forEach items="${storageOrder.goodsOrder}" var="goodsOrder">
			<c:set var="sum" value="${sum+goodsOrder.num}"></c:set>
			<div class="weui_cells weui_cells_access">
				<a class="weui_cell" href="javascript:;"
					style="border-bottom: #ddd 1px dashed;">
					<c:if test="${goodsOrder.state==30||goodsOrder.state==31||goodsOrder.state==32||goodsOrder.state==40||goodsOrder.state==41}"> 
					<input type="checkbox"  style="margin-right: 10px;" value="${goodsOrder.id}" parent="${storageOrder.id}" level="3" onclick="changeSelect(this,3)"/>
					</c:if>
					<c:if test="${goodsOrder.state!=30&&goodsOrder.state!=31&&goodsOrder.state!=32&&goodsOrder.state!=40&&goodsOrder.state!=41}"> 
					<div style="height:13px;width:23px;"></div>
					</c:if>
					<div class="weui_cell_hd">
						<img src="${goodsOrder.image}" alt="" onclick="gotoHtml('/${goodsOrder.goodsSku.id}.html')"
							style="width: 60px; height: 60px; margin-right: 5px; display: block">
					</div>
					<div class="weui_cell_bd weui_cell_primary">
						<p>${goodsOrder.name}</p>
						<h4>
							￥
							<fmt:formatNumber value="${goodsOrder.price/100}"
								pattern="#,###.##" />
						</h4>
						<p>X${goodsOrder.num}</p>
					</div>
				</a>
			</div>			
		</c:forEach>
	</c:forEach>
	<div>
		<div class="tjleft">
			<p>共${sum}件</p>
		</div>
		<div class="tjmid">
			<p>商品金额：</p>
			<p>优惠金额：</p>
			<p>运费：</p>
			<p>总计 ：</p>
		</div>
		<div class="tjright">
			<p>
				￥
				<fmt:formatNumber value="${order.goodsAmount/100}"
					pattern="#,###.##" />
			</p>
			<p>
				-￥
				<fmt:formatNumber value="${order.discountAmount/100}"
					pattern="#,###.##" />
			</p>
			<p>
				￥
				<fmt:formatNumber value="${order.freightAmount/100}"
					pattern="#,###.##" />
			</p>
			<p>
				￥
				<fmt:formatNumber value="${order.resultAmount/100}"
					pattern="#,###.##" />
			</p>
		</div>
	</div>
	<div class="button_sp_area" style="text-align: right;padding-right: 5px;margin-bottom:20px;" id="apply">
		<a href="javascript:apply();" class="weui_btn weui_btn_mini weui_btn_primary">申请售后</a>
	</div>

</body>

<script type="text/javascript" src="${staticPath}/js/app/order/detail.js"></script>
</html>

